package oop.Demo06;

public class Application {
    //一个对象的实际类型是确定的
    //可以只想的引用类型不确定
    public static void main(String[] args) {
        Student s1 = new Student();
        Person s2 = new Student();
        Object student = new Student();

        s1.run();
        s2.run();//子类重写了父类的方法，执行子类

        // Object>String
        // Object>Person>Student
        Object t1 = new Student();
        System.out.println(t1 instanceof Student);
        System.out.println(t1 instanceof Person);
        System.out.println(t1 instanceof Object);
        System.out.println(t1 instanceof Teacher);
        System.out.println(t1 instanceof String);
        System.out.println("================================");
        Person p1 = new Student();
        System.out.println(p1 instanceof Student);
        System.out.println(p1 instanceof Person);
        System.out.println(p1 instanceof Object);
        System.out.println(p1 instanceof Teacher);
        //System.out.println(p1 instanceof String);  编译报错


    }
}